<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<title>企业隐患整改</title>
	<link rel="stylesheet" href="/css/style.css">
	<link rel="stylesheet" type="text/css" href="/css/jquery.my-modal.1.1.winStyle.css" />
	<link rel="stylesheet" href="/css/esignDemo.css">
	<script src="/js/jquery.min.js"></script>
	<script type="text/javascript" src="/js/jquery.my-modal.1.1.js"></script>
</head>
<style type="text/css">
	#weiguineir,.chuna,#chrye{
	}
	.prd{
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	.push_button{
		background: #ededed;
		background-image: -webkit-linear-gradient(top, #ededed, #bab1ba);
		background-image: -moz-linear-gradient(top, #ededed, #bab1ba);
		background-image: -ms-linear-gradient(top, #ededed, #bab1ba);
		background-image: -o-linear-gradient(top, #ededed, #bab1ba);
		background-image: linear-gradient(to bottom, #ededed, #bab1ba);
		-webkit-border-radius: 15;
		-moz-border-radius: 15;
		border-radius: 15px;
		text-shadow: 0px 1px 0px #e1e2ed;
		-webkit-box-shadow: 3px 4px 0px 0px #899599;
		-moz-box-shadow: 3px 4px 0px 0px #899599;
		box-shadow: 3px 4px 0px 0px #899599;
		font-family: Arial;
		color: #3a8a9e;
		font-size: 16px;
		padding: 12px 30px 12px 30px;
		border: solid #d6bcd6 1px;
		text-decoration: none;
		margin: 15px;
	}
	.heading{
		margin: 5px;
	}
	.push_button:hover {
		color: #3a8a9e;
		background: #bab1ba;
		text-decoration: none;
	}
	.ha{
		width:100%;
	}
</style>
<body style="background: #F2F2F2;">
<form action="/danger/danger_save" method="post" enctype="multipart/form-data">

	<div class="bx zitidaxiao">

		<ul class="ybzl">
			<li><p class="gongsimingchneg-s">{{$company['comName']}}</p></li>
			<li><p>初查人</p><input disabled="disabled" type="text" value="{{$comcheck['checkUser']['name']}}" name="company[leader]" placeholder="" /></li>
			<li><p>初查日期</p><input disabled="disabled" type="text" value="{{$comcheck['created']}}" class="" name="" placeholder="请输入出初查日期"></li>
		</ul>
		<ul class="ybzls-s">
			@foreach($dangers as $key=>$danger)
				<li>
					@if(!empty($danger->entryId))
						<p class="awfa">{{$key+1}} {{$danger->entry}}</p>
					@else
						<p class="awfa">{{$key+1}} {{$danger->content}}</p>
					@endif
					<p class="awfa">{{$danger->accord}}</p>

					<p class="zhuapian-s">
						@foreach($danger->picturesArr as $image)
							<img style="width: 400px;height: 400px;" src="{{$image}}" alt="">
						@endforeach
					</p>
					<div class="caozuoann">
						<span class="status tiure1 @if($danger->status != 3)xuanzhong @endif" status-value="1">未整改</span>
						<span class="status tiure3 @if($danger->status == 3)xuanzhong @endif" status-value="3">已整改</span>
						<input type="hidden" name="hideDanger[{{$key}}][status]" class="statusValue" value="{{($danger->status == 2 || empty($danger->status))?1: $danger->status}}"/>
					</div>
					<?php $arr = explode('/',$danger->negatives);?>
					@foreach($arr as $ar)
						@if(!empty($ar))
							<h1 class="weigner prd gtred gieo" style="color: #363636">{{$ar}}</h1>
						@endif
					@endforeach
					<div class="shngcuan content3 tirs" style="@if($danger->status !=3)display: none @endif">
						<div id="dcontent" class="dcontent">
							<p style="display: none;" class="heading">上传文件列表：</p>
							<ul id="files" style="text-align:left;display: none;">

							</ul>
							<div class="turae"></div>
							<input class="chryec wight-s" type="text"  date-c="{{$key}}" date-d="3" value="{{$danger->remark or ''}}"  name="hideDanger[{{$key}}][remark]" placeholder="请输入文字描述">
							<input class="chryec wight-s" type="hidden"  date-c="{{$key}}" date-d="3" value="{{$danger->content or ''}}"  name="hideDanger[{{$key}}][content]" placeholder="请输入文字描述">
							<table>
								<tbody>
								<tr class="ha">
									<td><div class="push_button" onclick="appendByCamera()">拍照</div></td>
									<td><div class="push_button" onclick="appendByGallery()">相册</div></td>
									<td><div name="picture[{{$key}}]" class="push_button" onclick="upload(this,{{$key}},3)">上传</div>
									</td>
								</tr>
								<input type="hidden"  name="hideDanger[{{$key}}][pictures]" id="img{{$key}}3" value="" />
								<tr class="ha">
								</tr>
								</tbody>
							</table>
						</div>
					</div>
					@if($come_from=='check')
						<input type="hidden" name="hideDanger[{{$key}}][checkDetailId]" value="{{$danger->detailId}}"/>
						<input type="hidden" name="hideDanger[{{$key}}][detailId]" class="inputIDs" value="{{$danger->id}}"/>
					@elseif($come_from=='checkDanger')
						<input type="hidden" name="hideDanger[{{$key}}][checkDetailId]" value="{{$danger->checkDetailId}}"/>
						<input type="hidden" name="hideDanger[{{$key}}][detailId]" class="inputIDs" value="{{$danger->detailId}}"/>
					@endif
					<input type="hidden" name="hideDanger[{{$key}}][groupId]" value="{{$danger->groupId}}"/>
					<input type="hidden" name="hideDanger[{{$key}}][entryId]" class="inputIDs" value="{{$danger->entryId}}"/>
				</li>
			@endforeach
		</ul>

	</div>
{{ csrf_field() }}
<!--负责人签名-->
	<div>
		<p class="trud">单位负责人签字：</p>
		<div class="canvasDiv">
			<div id="editing_area">
				<canvas width="450" height="250" id="canvasEdit"></canvas>
			</div>
		</div>

		<div class="imgDiv">
			<span id="sign_show"></span>
			<input type="hidden" name="companySign" value="" id="beijiancharen"/>
		</div>

		<div class="btnDiv">
			<a id="sign_clear" class="clearBtn">清除</a>
			<a id="sign_ok" class="okBtn">确认</a>
		</div>
	</div>
	<input type="hidden" name="come_from" value="{{$come_from}}"/>
	<input type="hidden" name="companyId" value="{{$company['id']}}"/>
	<input type="submit" class="qrtj dibuann" id="btn-submit" value="提交">
</form>

<script>
	$(document).ready(function(){
		$(".status").click(function(){
			/*更改选中状态*/
			$(this).parent().find(".status").removeClass("xuanzhong");
			$(this).addClass("xuanzhong");
			/*更改选中的状态值*/
			var status = $(this).attr("status-value");
			$(this).parent().find(".statusValue").val(status);
			/*更改文字描述和上传按钮*/
			$(this).parent().parent().find(".shngcuan").attr("style", "display:none").removeClass("dangqian");
			$(this).parent().parent().find(".content"+status).attr("style","display:block").addClass("dangqian");

		});
		//验证提交表表单
		$('#btn-submit').click(function () {
			var form = $(this).parents('form');
			//验证签名
			var companySign = $.trim($("#beijiancharen").val());
			var validate_m = new MyModal.modal(function() {});
			if(companySign.length <= 0) {
				$("#errorText").text('请单位负责人签字');
				validate_m.show();
				return false;
			}
			form.submit();
		})

	});
</script>



<script type="text/javascript" src="/js/esigntwo.js"></script>
<script type="text/javascript" src="/js/esignone.js"></script>
<script type="text/javascript">
	$(function(){
		//初始化动作，根据DOM的ID不同进行自定义，如果不写则内部默认取这四个
		$().esign("canvasEdit", "sign_show", "sign_clear", "sign_ok");
	});
	$(function(){
		//初始化动作，根据DOM的ID不同进行自定义，如果不写则内部默认取这四个
		$().esignone("canvasEditone", "sign_showone", "sign_clearone", "sign_okone");
	});
</script>
<script type="text/javascript">
	var server="http://book.ccshe.com/upload/uploadimg";
	var files=[];
	// 上传文件
	function upload(a,b,c){
		console.log(c);
		if(files.length<=0){
			plus.nativeUI.alert("没有添加上传文件！");
			return;
		}

		var wt=plus.nativeUI.showWaiting();
		var task=plus.uploader.createUpload(server,
				{method:"POST"},
				function(t,status){ //上传完成
					var rsult=JSON.parse(t.responseText);

					if(status==200){
						var yu='img'+b+c;
						var td = a.parentNode;
						var tr = td.parentNode;
						var newImg = document.createElement("img");
						//document.getElementByname('img').value += rsult.data + ',';
						document.getElementById(yu).value += rsult.data + ',';
						newImg.src = rsult.data;

						tr.appendChild(newImg);

						wt.close();
					}else{
						outLine("上传失败："+status);
						wt.close();
					}
				}
		);
		task.addData("client","HelloH5+");
		task.addData("uid",getUid());
		for(var i=0;i<files.length;i++){
			var f=files[i];
			task.addFile(f.path,{key:f.name});
		}
		task.start();
		files=[];
	}
	// 拍照添加文件
	function appendByCamera(){
		plus.camera.getCamera().captureImage(function(p){
			appendFile(p);
		});
	}
	// 从相册添加文件
	function appendByGallery(){
		plus.gallery.pick(function(p){
			appendFile(p);
		});
	}
	// 添加文件
	var index=1;
	function appendFile(p){
		var fe=document.getElementById("files");
		var li=document.createElement("li");
		var n=p.substr(p.lastIndexOf('/')+1);
		li.innerText=n;
		fe.appendChild(li);
		files.push({name:"fileImg",path:p});
		index++;
		empty.style.display="none";
	}
	// 产生一个随机数
	function getUid(){
		return Math.floor(Math.random()*100000000+10000000).toString();
	}
</script>
@include('error.alerts')
</body>
</html>